/* eslint-disable no-duplicate-case */
const express = require('express');
const router = express.Router();

router.get('/me', (req, res) => {
    res.json({
        payload: {
            id: '1001',
            name: '张三',
            username: 'sam',
            enterpriseName: '奇瑞销售股份有限公司',
            roles: ['销售顾问']
        }
    });
});

router.get('/me/pages/:code', (req, res) => {
    const {code} = req.params;
    let payload = [];
    switch(code) {
        case 'dcs-parts-cabinetApply':
            payload = [
                'reject',
                'apply',
            ];
            break;
        case 'dcs-parts-part':
            payload = [
                'updateOrderable',
                'updateWarrantyType',
                'importWarrantyType',
                'export',
                
            ];
            break;
        case 'dcs-parts-parts':
            payload = [
                'freeze',
                'thaw',
                'importCheckAttributes',
                'importSalesAttributes',
                'exportBasicDatas',
                'exportCheckedProperties',
                'exportSalesAttributes',
                'exportPartSalesPrice',
                'update'
            ];
            break;
        case 'dcs-parts-bank':
            payload = [
                'add',
                'update',
                'abandon',
            ];
            break;
        case 'dcs-parts-orderUnmetReason':
            payload = [
                'add',
                'update',
                'abandon',
            ];
            break;
        case 'dcs-parts-orderSatisfactionRuleInformation':
            payload = [
                'add',
                'update',
                'abandon',
                'import'
            ];
            break;
        case 'dcs-parts-partSaleOrder':
            payload = [
                'export',
                'add',
                'update',
                'approve',
                'submit',
                'abandon',
                'assistAdd',
                'assistUpdate',
                'assistSubmit',
                'create',
                'hisOrder'
            ];
            break;
        case 'dcs-parts-accessoryOrder':
            payload = [
                'export',
                'add',
                'update',
                'submit',
                'confirm',
                'abandon',
                'assistAdd',
                'assistUpdate',
                'assistSubmit',
                'assistAbandon',
                'import',
                'return'
            ];
            break;
        case 'dcs-parts-customsClearance':
            payload = [
                'declare',
                'clearancet'
            ];
            break;
        case 'dcs-parts-deliveryOrder':
            payload = [
                'export',
                'update',
                'close',
                'sap',
            ];
            break;
        case 'dcs-parts-packingListCabinetApply':
            payload = [
                'add',
                'update',
                'edit',
            ];
            break;
        case 'dcs-parts-packingList':
            payload = [
                'import',
                'update',
                'close',
                'pack',
                'export'
            ];
            break;
        case 'dcs-parts-partShipOrder':
            payload = [
                'add',
                'update',
                'ship'
            ];
            break;
        case 'dcs-parts-partSaleOrderType':
            payload = [
                'update',
            ];
            break;
        case 'dcs-parts-partSalesPermission':
            payload = [
                'submitRuleImport',
                'raisingRateUpdate',
                'warehouseUpdate'
            ];
            break;
        case 'dcs-parts-dealerPartArriveClaim':
            payload = [
                'update',
                'add',
                'submit',
                'export',
                'abandon',
                'firstApprove',
                'finalApprove',
                'handle',
                'print'
            ];
            break;
        case 'dcs-parts-dealer':
            payload = [
                'update',
            ];
            break;
        case 'dcs-parts-dealerPartInformation':
            payload = [
                'update',
                'import'
            ];
            break;
        case 'dcs-parts-subDealer':
            payload = [
                'add',
                'update',
                'abandon',
                'import',
            ];
            break;
        case 'dcs-parts-workingDay':
            payload = [
                'update',
                'import',
            ];
            break;
        case 'dcs-parts-partOrderPlan':
            payload = [
                'add',
                'update',
                'submit',
                'abandon',
                'export',
                'approve',
                'historySearch'
            ];
            break;
        case 'dcs-parts-packingListTrack':
            payload = [
                'export',
            ];
            break;
        case 'dcs-parts-exchangeRate':
            payload = [
                'add',
                'update',
                'export',
            ];
            break;
        case 'dcs-parts-carrier':
            payload = [
                'add',
                'update',
                'abandon',
                'export'
            ];
            break;
        case 'dcs-parts-lccCreditManagement':
            payload = [
                'register',
                'receive',
                'export',
                'close'
            ];
            break;
        case 'dcs-parts-stockRequirement':
            payload = [
                'add',
                'export',
            ];
            break;
        case 'dcs-parts-picking':
            payload = [
                'delivery',
                'posting',
                'export',
            ];
            break;
        case 'dcs-parts-partInvoice':
            payload = [
                'order',
                'details'
            ];
            break;
        case 'dcs-parts-partInvoiceManage':
            payload = [
                'add',
                'update',
                'abandon',
                'uploadSAP',
                'historySearch'
            ];
            break;
        case 'dcs-parts-partShipNotice':
            payload = [
                'add',
                'update',
                'outbound'
            ];
            break;
        case 'dcs-parts-shipmentConfirm':
            payload = [
                'update',
                'add',
                'abandon'
            ];
            break;
        case 'dcs-parts-partShipment':
            payload = [
                'shipment',
                'import'
            ];
            break;
        case 'dcs-parts-partStock':
            payload = [
                'import',
                'export'
            ];
            break;
        case 'dcs-parts-partBackOrder':
            payload = [
                'confirmor',
                'close',
                'confirmorAll',
                'closeAll',
                'export',
                'import',
                'approve',
                'approveAll',
            ];
            break;
        case 'dcs-parts-partClaim':
            payload = [
                'add',
                'update',
                'submit',
                'approve',
                'abandon',
                'export',
                'hisOrder'
            ];
            break;
        case 'dcs-parts-partShipmentSignFor':
            payload = [
                'signfor',
            ];
            break;
        case 'dcs-parts-partShipmentDeliver':
            payload = [
                'deliver',
                'backOrder',
                'close',
                'detail'
            ];
            break;
        case 'dcs-parts-partClaimDecision':
            payload = [
                'approve',
                'confirm',
                'export'
            ];
            break;
        case 'dcs-parts-partClaimReport':
            payload = [
                'add',
                'update',
                'confirm',
                'abandon',
                'print'
            ];
            break;
        case 'dcs-parts-partOrderPi':
            payload = [
                'add',
                'update',
                'abandon',
                'create',
                'confirm',
                'printExcel',
                'printPdf',
                'audit',
                'cancel',
                'historySearch'
            ];
            break;
        case 'dcs-parts-partInvoiceExport':
            payload = [
                'listExcel',
                'invoiceExcel',
                'noticeExcel',
                'orderExcel',
                'packingExcel',
                'packingPdf',
                'confirmExcel'
            ];
            break;
        case 'dcs-parts-partClaimCacu':
            payload = [
                'add',
                'update',
                'confirmor',
                'invoice',
                'print',
                'abandon'
            ];
            break;
        case 'dcs-parts-dutyUnit':
            payload = [
                'add',
                'update',
                'start',
                'stop'
            ];
            break;
        case 'dcs-parts-accountQuery':
            payload = [
                'export'
            ];
            break;
        case 'dcs-parts-accountExchangeQuery':
            payload = [
                'export'
            ];
            break;
        case 'dcs-parts-returnBalanceQuery':
            payload = [
                'export'
            ];
            break;
        case 'dcs-parts-returnDetailedQuery':
            payload = [
                'export'
            ];
            break;
        case 'dcs-parts-hsCode':
            payload = [
                'add',
                'update',
                'abandon',
                'export',
                'import',
                'partimport'
            ];
            break;
        case 'dcs-parts-partSaleOrderTrack':
            payload = [
                'printExcel',
                'printPdf',
                'export',
                'detailExport',
            ];
            break;
        case 'dcs-parts-deliveryOrderTrack':
            payload = [
                'export',
            ];
            break;
        case 'dcs-parts-partInvoiceTrack':
            payload = [
                'export',
                'detailExport',
            ];
            break;
        case 'dcs-parts-partStockReport':
            payload = [
                'export',
                'detailExport',
            ];
            break;
        case 'dcs-parts-notice':
            payload = [
                'add',
                'noticeProgram',
                'signinStatistics',
                'release',
                'cancel',
                'abandon',
                'signfor',
                'update',
            ];
            break;
        case 'dcs-parts-partDataModifyLog':
            payload = [
                'deliveryOrder',
                'partSaleOrder',
            ];
            break;
        case 'dcs-parts-partSalesPrice':
            payload = [
                'export'
            ];
            break;
        case 'dcs-parts-dealerPartResource':
            payload = [
                'export',
                'increImport',
                'batchDelete',
                'importDelete'
            ];
            break;
        case 'dcs-parts-planComsatRate':
            payload = [
                'export'
            ];
            break;
        case 'dashboard-workplace':
            payload = [
                'notification',
                'partOrderPlan',
                'claimSettlement',
                'expenseAdjustment',
                'backorder',
                'partStock',
                'workingHour',
                'assistPart',
                'servicePrice',
            ];
            break;
        case 'dcs-parts-partOrderSupply':
            payload = [
                'export',
            ];
            break;
        case 'dcs-parts-partOrderRateShipmentDay':
            payload = [
                'export',
            ];
            break;
        case 'dcs-parts-partClaimReportForm':
            payload = [
                'export',
            ];
            break;
        case 'dcs-parts-partStockMonth':
            payload = [];
            break;
        default:
            payload = [
                'add',
                'update',
                'disable'
            ];
    }
    
    res.json({payload});
});

module.exports = router;
